package com.ssm.opa.web.controller;

import com.ssm.opa.common.base.exception.OPAException;
import com.ssm.opa.common.entity.dto.BaseResponse;
import com.ssm.opa.common.entity.dto.request.DemoRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 */
@Controller
@RequestMapping(value = "/demo")
public class DemoController {

	private Logger LOGGER = LoggerFactory.getLogger(DemoController.class);

	@RequestMapping(value = "/openApi", method = RequestMethod.POST)
	@ResponseBody
	public BaseResponse openApi(@RequestBody DemoRequest demoRequest)throws OPAException {
		BaseResponse baseResponse = new BaseResponse();

		if(false) {
			throw OPAException.AUTHORITY_ERROR;
		}

		baseResponse.setMsg("测试Demo数据");
		baseResponse.setData(demoRequest);
		return baseResponse;
	}
}
